const { Service } = require('ee-core');

const fs = require("fs");

class fileService extends Service {
	constructor (props) {
		super(props);
	}

	async readFile (path) {
		return await this.read(path)
	}

	read (path) {
		return new Promise((resolve, reject) => {
			fs.readFile(path, (err, data) => {
				if (err) {
					reject(err.message);
				} else {
					resolve(data);
				}
			});
		})
	}
}

fileService.toString = () => '[class fileService]';
module.exports = fileService;
